import instance from "./request"
import qs from "qs"
// 这个文件用来统一管理项目中所有的api链接

// 首页精品推荐的请求
export const JinpinAPI = () => instance.get("/products/recommend");
// 热门兑换的请求
export const popularRedemptionAPI = () => instance.get("/products/hot");



// 发送注册短信验证码请求
export const SendSMSAPI = (params) => instance.post("/sendSMS", qs.stringify(params));

// 手机号验证码登录(含注册)
export const PhoneReginAPI = (params) => instance.post("/phoneRegin", qs.stringify(params));


/* SendSMSAPI ({
    phone: 用户输入手机号
}) */
/* JSON.stringify({name: 'Vue'}) // 
"{name: 'Vue'}"
console.log(qs.stringify({name: "Vue"}));  // 将对象转换为字符串 "name=Vue" */

// 微信登录
export const WeixinLoginApI = (params) => instance.post("/wechatUsers/PCLogin", qs.stringify(params));

// 手机绑定微信
export const WexinBindingApI = (params) => instance.post("/wechatUsers/binding", qs.stringify(params));

// 获取用户信息
export const UserProfilesAPI = () => instance.get("/shop/userProfiles");

// 获取商品详情
export const GoodDetailsAPI = (id) => instance.get(`/products/${id}`);

// 加入购物车
export const addShopCartApI = (params) => instance.post("/shop/carts/add", qs.stringify(params));

// 商品搜索（含首页的“更多”）
export const SearchGoodsAPI = (params) => instance.get(`/products`,{params});

// 查看购物车
export const ViewShopCartAPI = () => instance.get("/shop/carts");

// 购物车删除商品
export const DeleteShopCartItemsAPI = (id) => instance.delete(`/shop/carts?productIds=${id}`);









